﻿using System;
using Microsoft.Extensions.Configuration;
namespace Infrastructure
{
    public static class Utility
    {
		/// <summary>
		/// 从配置文件读取连接字符串
		/// </summary>
		/// <returns></returns>
		public static string GetConnectionString()
        {
			string baseDirectory = AppContext.BaseDirectory;
            IConfigurationRoot Configuration;

			var builder = new ConfigurationBuilder()
				.SetBasePath(baseDirectory)
				.AddJsonFile("appsettings.json", true, true);

			Configuration = builder.Build();
			return Configuration["connectionString"];
        }
    }
}
